package com.shayu.aicodemother.service;

import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.core.service.IService;
import com.shayu.aicodemother.exception.BusinessException;
import com.shayu.aicodemother.exception.ErrorCode;
import com.shayu.aicodemother.exception.ThrowUtils;
import com.shayu.aicodemother.model.dto.app.AppAddRequest;
import com.shayu.aicodemother.model.dto.app.AppQueryRequest;
import com.shayu.aicodemother.model.entity.App;
import com.shayu.aicodemother.model.entity.User;
import com.shayu.aicodemother.model.enums.CodeGenTypeEnum;
import com.shayu.aicodemother.model.vo.AppVO;
import reactor.core.publisher.Flux;

import java.io.Serializable;
import java.util.List;

/**
 * 应用 服务层。
 *
 * @author <a href="https://so.gitee.com/?q=%E8%8E%8E%E5%A3%AB%E6%AF%94%E8%B0%AD">程序员鲨鱼</a>
 */
public interface AppService extends IService<App> {




    /**
     *通过对话生成应用代码
     * @param appId
     * @param message
     * @param loginUser
     * @return
     */
    Flux<String> chatToGenCode(Long appId, String message, User loginUser) ;


    /**
     * 创建appid
     * @param appAddRequest
     * @param loginUser
     * @return
     */
    Long createApp(AppAddRequest appAddRequest, User loginUser);

    /**
     * 根据应用id查询
     * @param app
     * @return
     */
    AppVO getAppVO(App app);


    /**
     * 创建一个查询条件
     * @param appQueryRequest
     * @return
     */
    QueryWrapper getQueryWrapper(AppQueryRequest appQueryRequest);


    /**
     * 将从数据库中查询到的数据进行脱敏
     * @param records
     * @return
     */
    List<AppVO> getAppVOList(List<App> records);


    /**
     * 应用部署
     * @param appId 应用id
     * @param loginUser 登录用户
     * @return
     */
    String deployApp(Long appId, User loginUser);

    boolean removeById(Serializable id);
}
